/** Easy As Pie Responsive Navigation Plugin - Version 1.1

 https://github.com/chrisdivyak/EasyAsPie/
 
 The MIT License (MIT)

 * Copyright (c) 2014 Chris Divyak

 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:

 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.

 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
*/
(function(e){e.fn.extend({easyPie:function(t){var n={icon:"+",navClass:"applePie",collapseClass:"pieCollapse",slideTop:true};var t=e.extend(n,t);return this.each(function(){function r(t){e("html,body").delay(500).animate({scrollTop:e(t).offset().top-48},"fast")}var n=t;if(e(window).width()>800){e("."+n.navClass).superfish({delay:0,speed:"fast"})}if(e(window).width()<=800){e("li").find("ul").addClass(n.collapseClass);e("."+n.navClass+"span").remove();e("ul."+n.collapseClass).before("<span>"+n.icon+"</span>")}e(window).on("resize",function(){if(e(window).width()<=800){e("."+n.navClass+" li span").unbind("click").click(function(t){t.preventDefault();e(this).next().slideToggle(function(){e(this).parent().toggleClass("menuOpen")});if(n.slideTop==true){r(e(this));return false}else{return false}});e("."+n.navClass).superfish("destroy");if(e("."+n.navClass+" li span").length<1){e("."+n.navClass+" li > ul").before("<span>"+n.icon+"</span>")}if(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)){e("."+n.navClass+" ul ul:first").show()}}if(e(window).width()>800){e("."+n.navClass+" ul:first").show();e("."+n.navClass).superfish({delay:0,speed:"fast"})}});e("."+n.navClass+" li span, .menubtn").unbind("click").click(function(t){t.preventDefault();e(this).next("ul").slideToggle(function(t){e(this).parent().toggleClass("menuOpen")});if(e("."+n.navClass+"ul:first").is(":visible")){e(".menubtn").addClass("menuOpen")}if(e("."+n.navClass+"ul:first").is(":hidden")){e(".menubtn").removeClass("menuOpen")}if(n.slideTop==true){r(e(this));return false}else{return false}})})}})})(jQuery);
//If the menu has a hash tag in href, slidetoggle menu
$(window).on("hashchange", function () {if ($(window).width() <= 800) {$("#nav").slideToggle();}});
